<?php
/**
 * Created by PhpStorm.
 * User: venki
 * Date: 2023/12/16
 * Time: 16:26
 */

namespace app\modelFilter;

class BookFilter extends Filter
{
    public $name;
    public $title;

    /**
     * @explain description function feature
     * @return array
     * @maxim   from focus to execute
     * @author  venki.chen 2023/12/16 17:04
     */
    public function rules(): array
    {
        return [
            [['name', 'title'], 'safe'],
        ];
    }

    /**
     * @explain description function feature
     * @param
     * @return void
     * @maxim   from focus to execute
     * @author  venki.chen 2023/12/16 17:04
     */
    protected function filterByName($value): void
    {
        $this->query->andFilterWhere(['like', 'name', $value]);
    }

    /**
     * @explain description function feature
     * @param
     * @return void
     * @maxim   from focus to execute
     * @author  venki.chen 2023/12/16 17:05
     */
    protected function filterByTitle($value): void
    {
        $this->query->andFilterWhere(['like', 'title', $value]);
    }
}
